import { CharacterState, AirState } from "shared/enums/CharacterState"
/**
 * 状态
 */
const stateConfig: {
    [key: number]: Ctn.CharacterState.State
} = {
    [CharacterState.none]: {
        setAirStates: AirState.none,
        transform: {
            [CharacterState.FreeFalling]: {
                transitionTime: 0.2
            },
            [CharacterState.Standing]: {
                transitionTime: 0
            },
            [CharacterState.Running]: {
                transitionTime: 0
            },
        }
    },
    [CharacterState.Running]: {
        turnEnable: true,
        setAirStates: AirState.Ground,
        transform: {
            [CharacterState.Standing]: {
                transitionTime: 0.2
            },
        },
        forbiddenFrom: [CharacterState.Skilling]
    },
    [CharacterState.Climbing]: {
        setAirStates: AirState.Climbing,
        speedEnable: true,
        forbiddenFrom: [CharacterState.Skilling]
    },
    [CharacterState.Standing]: {
        turnEnable: true,
        setAirStates: AirState.Ground,
        transform: {
            [CharacterState.Running]: {
                transitionTime: 0.2
            },
        },
        forbiddenFrom: [CharacterState.Skilling, CharacterState.DownJumping]
    },

    [CharacterState.Jumping]: {
        turnEnable: true,
        life: {
            duration: 0.31,
            autoTransfrom: [
                {
                    airStates: AirState.Air,
                    targetStates: CharacterState.FreeFalling,
                }
            ]
        },
        setAirStates: AirState.Air,
        forbiddenFrom: [CharacterState.Skilling]

    },
    [CharacterState.DownJumping]: {
        turnEnable: true,
        life: {
            duration: 0.1,
            autoTransfrom: [
                {
                    // airStates: AirState.Air,
                    fall: true,
                    targetStates: CharacterState.DownFalling,
                },

            ]
        },
        setAirStates: AirState.none,
        forbiddenFrom: [CharacterState.Skilling]

    },
    [CharacterState.DownFalling]: {
        turnEnable: true,
        life: {
            duration: 0.1,
            autoTransfrom: [
                {
                    airStates: AirState.Air,
                    targetStates: CharacterState.FreeFalling,
                },

            ]
        },
        setAirStates: AirState.none,
        forbiddenFrom: [CharacterState.Skilling]

    },
    [CharacterState.FreeFalling]: {
        setAirStates: AirState.Air,
        forbiddenFrom: [CharacterState.Jumping, CharacterState.Skilling
            , CharacterState.DownJumping
        ]

    },
    [CharacterState.WallHeaderHang]: {
        setAirStates: AirState.none,
        forbiddenFrom: [CharacterState.Skilling],
        transform: {
            [CharacterState.Jumping]: {
                transitionTime: 0.2
            },
            [CharacterState.FreeFalling]: {
                transitionTime: 0.2
            },
        },
    },
    [CharacterState.WallHeaderClimb]: {
        setAirStates: AirState.none,
        forbiddenFrom: [CharacterState.Skilling],
        life: {
            duration: 0.5,
            autoTransfrom: [
                {
                    airStates: AirState.Air,
                    targetStates: CharacterState.FreeFalling,
                },
                {
                    airStates: AirState.Ground,
                    targetStates: CharacterState.Standing,
                }
            ]
        },
        transform: {
            [CharacterState.Jumping]: {
                transitionTime: 0.2
            },
            [CharacterState.FreeFalling]: {
                transitionTime: 0.2
            },
        },
    },
    [CharacterState.Crouch]: {
        turnEnable: true,
        setAirStates: AirState.Ground,
        transform: {
            [CharacterState.Running]: {
                transitionTime: 0.2
            },
        },
        forbiddenFrom: [CharacterState.Skilling, CharacterState.DownJumping]
    },
}
export default stateConfig